package pl.edu.utp.kursy.comparators;

import java.util.Comparator;
import pl.edu.utp.kursy.database.Worker;

public class WorkerComparator implements Comparator<Worker>{

    @Override
    public int compare(Worker o1, Worker o2) {
        
        String surname1 = o1.getSurname();
        String surname2 = o2.getSurname();
        String name1 = o1.getName();
        String name2 = o2.getName();
        
        if(surname1.compareTo(surname2) == 0){
            return name1.compareTo(name2);
        }else{
            return surname1.compareTo(surname2);
        }
    }
}
